Imports System.Web.UI.WebControls
Namespace Paginacion
    Public Class helperPaginacion
        Public Shared Sub llenarpaginas(ByRef control As System.Web.UI.WebControls.ListControl, ByVal total As Integer, ByVal cantPagina As Integer, Optional ByVal paginaActual As Integer = 1)
            Dim i As Integer
            Dim li As ListItem
            Dim paginas As Integer = total \ cantPagina
            control.Items.Clear()
            If total Mod cantPagina <> 0 Then paginas += 1
            For i = 1 To paginas
                li = New ListItem(i.ToString, i.ToString)
                If paginaActual = i Then li.Selected = True
                control.Items.Add(li)
            Next
        End Sub

    End Class
End Namespace